package xcmg.device.infra.enums;

/**
 * 下游企业在平台状态（1未邀请，2已邀请，3待审核，4审核拒绝，5审核通过）
 */
public enum CompanyDealerStatusEnum
{
    Uninvited(1, "未邀请"),
    Invited(2, "已邀请"),
    ToAudit(3, "待审核"),
    Failed (4, "审核拒绝"),
    Pass (5, "审核通过"),
;
    private String desc;
    private Integer code;
    CompanyDealerStatusEnum(Integer code, String desc){
        this.desc = desc;
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public Integer getCode() {
        return code;
    }

    /**
     * 通过code获取对应的企业状态枚举
     * @param code Integer
     * @return
     */
    public static CompanyDealerStatusEnum getDealerStatus(Integer code) {
        for (CompanyDealerStatusEnum dealerStatus : CompanyDealerStatusEnum.values()) {
            if (code.equals(dealerStatus.getCode())) {
                return dealerStatus;
            }
        }
        return null;
    }

}
